package com.yfqy.app.security.login;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.yfqy.app.enums.LoginType;
import com.yfqy.app.security.GrantedAuthorityDeserializer;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.util.List;

/**
 * @Author: 梁二东
 * @Date: 2025/5/6 16:41
 * @Description:
 **/

@Data
public class LoginUserInfo {

    private String sessionKey;

    /**
     * username,jscode
     */
    private LoginType loginType;
    private String sessionId; // 会话id，全局唯一
    private Long id;
    private String nickname; // 昵称

    private Long expiredTime; // 过期时间

    // 登录用的角色+权限
    @JsonDeserialize(using = GrantedAuthorityDeserializer.class)
    private List<SimpleGrantedAuthority> authorities;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 微信openid
     */
    private String openid;

    /**
     * 微信unionid
     */
    private String unionid;

    /**
     * 注册来源ID
     */
    private Long regFromId;

    private String avatarUrl;

    private byte isLeader;
}
